<template>
  <div>
	  <div>
      <div style="margin:2% 0;display: inline-block;">
        <span>审核结果:</span>
        <el-select v-model="results" placeholder="请选择审核结果" style="width:150px;"  @change="selectTrigger(sort)">
          <el-option v-for="item in resultsOptions" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </div>
	  </div>
	  <el-table
		v-loading="tableDataLoading"
	    :data="tableData.content"
		row-key="id">
      <el-table-column prop="nickName" label="名字"/>
      <el-table-column prop="badge" label="头像" width="120">
        <template slot-scope="scope">
          <div v-if="scope.row.headImg == '' || scope.row.headImg == null">
            <img src="~@/assets/img/avatar.png" alt="" width="60" height="60">
          </div>
          <div v-else>
            <img :src="scope.row.headImg" alt="" width="60" height="60">
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="gameType" label="游戏类型">
        <template slot-scope="scope">
          {{scope.row.gameType == 1? '王者': '吃鸡'}}
        </template>
      </el-table-column>
      <el-table-column prop="skill" label="擅长位置">
        <template slot-scope="scope">
          <span>{{scope.row.skill ? scope.row.skill : '未设置'}}</span>
        </template>
      </el-table-column>
      <el-table-column prop="dan" label="段位"/>
      <el-table-column prop="area" label="可接区服">
        <template slot-scope="scope">
          <span>{{scope.row.area ? scope.row.area == 1? '微信': 'qq' : '未设置'}}</span>
        </template>
      </el-table-column>

      <el-table-column prop="results" label="审核状态">
        <template slot-scope="scope">
          <el-tag
            :type="scope.row.result === 1 ? 'success' : scope.row.result == 0? 'info': 'primary'"
            disable-transitions>{{scope.row.result == 0? '未审核': scope.row.result == 1? '审核通过': '审核失败' }}</el-tag>
        </template>
      </el-table-column>

      <el-table-column
        prop="createTime"
        label="创建时间">
      </el-table-column>
	    <el-table-column
	      label="操作"
        align="center"
        fixed="right">
	      <template slot-scope="scope">
          <el-button size="mini" type="primary" @click="updates(scope.row)">详情
          </el-button>
	      </template>
	    </el-table-column>
	  </el-table>
	  <div style="text-align: center;margin-top: 10px;">
	    <el-pagination
	      @size-change="handleSizeChange"
	      @current-change="handleCurrentChange"
	      :page-sizes="[5, 10, 15, 20]"
	      :page-size="size"
	      :current-page="page"
	      layout="total,sizes, prev, pager, next"
	      :total="tableData.totalElements">
	    </el-pagination>
	  </div>
  </div>
</template>

<script>
	export default {
	    data() {
	      return {
				size:5,
				page:1,
        userId: null,
        results: null,
        area: null,
        resultsOptions: [
          {
            label: '待审核',
            value: 0
          },
          {
            label: '审核通过',
            value: 1
          },
          {
            label: '审核未通过',
            value: 2
          },
        ],
				tableDataLoading:false,
        tableData:{
          content: []
        },
			}
		},
		methods: {
      // select自动选择
      selectTrigger() {
        this.dataSelect()
      },
      // 查询
      select() {
        this.page = 1
        this.size = 5
        this.dataSelect()
      },
			handleSizeChange (val) {
			  this.size = val
			  this.dataSelect()
			},
			handleCurrentChange (val) {
			  this.page = val
			  this.dataSelect()
			},
      // 详情跳转
      updates (row) {
        this.$router.push({ path: '/whereasDetail', query: { id: row.id,type: 2 } })
      },
      // 获取数据
      dataSelect () {
        let page = this.page - 1
        this.tableDataLoading = true
        this.$http({
          url: this.$http.adornUrl2('/whereas/reviewList'),
          method: 'get',
          params: this.$http.adornParams({
            'page':page,
            'size':this.size,
            'results':this.results
          })
        }).then(({data}) => {
          this.tableDataLoading = false
          // console.log(data)
          this.tableData = data.data || {content: []};
        })
      }
		},
    mounted() {
      this.dataSelect()
    }
	  };
</script>

<style>

</style>
